<template>
  <div>
    <div class="content">
      <div class="groupProduct_title_content">
        <span class="groupProduct_title">{{ content.title }}</span>
      </div>
      <div class="product_content">
        <div class="product_item" v-for="item in products">
          <div style="width:173px;height:175px;">
            <img :src="item.thumbnail" style="width:173px;height:175px;"></img>
          </div>
          <div class="product_info_content">
            <div>
              <span class="column_product_title">{{ item.name }}</span>
            </div>
            <div class="price_content">
              <div class="subsidy_content">
                <span style="color:white;font-size:10px">领红包</span>
              </div>
              <div>
                <span style="font-size:15px;color:#d03629;margin-left:10px">¥</span>
                <span style="font-size:15px;color:#d03629">{{ item.point / 100 }}</span>
              </div>
            </div>
          </div>
        </div>
        <noData v-if="products.length===0" style="height: 100%"></noData>
      </div>

    </div>
  </div>
</template>

<script>
import {list} from '@/api/bargainBuy'
import utils from '@/utils/utils'
import noData from "@/views/designer/components/product/components/noData";
export default {
  name: 'bargainProductRow',
  data() {
    return {
      heads: [
        'http://cdnx.hulu.fj.cn/01/B5/rBD_P17--KKAHKlCAAIDjWbO9GU125.jpg',
        'http://cdnx.hulu.fj.cn/01/AD/rBD_P17zBQuAHCIkAAgtwmclk6M186.jpg',
        'http://rzico.oss-cn-shenzhen.aliyuncs.com/img/more.png'
      ],
      length: '',
      index: [],
      pageSize: 2,
      products: []
    }
  },
  props: [
    'content'
  ],
  components:{
    noData
  },
  created() {

    this.loadProduct()
  },
  methods: {
    loadProduct() {
      let param = new URLSearchParams()
      param.append('pageSize', this.pageSize)
      list(param).then(res => {
        res.data.data.forEach(item => {
          if (utils.isNull(item.thumbnail)) {
            item.thumbnail = 'http://cdnx.hulu.fj.cn/00/4B/rBD_P13d876ATFO4AAT07C99LBw961.jpg'
          }

        })
        this.products = res.data.data
      })
    }
  },
}
</script>

<style scoped>
.content {
  padding: 10px;
  background-color: white;
  border-radius: 8px;
  width: 355px;
  box-sizing: border-box;
  margin: 0px 10px;
  padding-left: 5px;
  padding-right: 5px;
}

.groupProduct_title {
  font-size: 18px;
  font-weight: 500;
}

.product_content {
  display: flex;
  margin-top: 10px;
  flex-direction: row;

}

.product_item {
  overflow: hidden;
  width: 160px;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  /* box-shadow: 2px 2px 2px 2px rgb(248, 248, 248); */
  box-shadow: 0px 0px 15px #00000015;
  margin-left: 6px;
  margin-right: 6px;
}

.product_info_content {
  background-color: white;
  width: 160px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
}

.column_product_title {
  width: 155px;
  display: block;
  font-size: 14px;
  line-height: 20px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.price_content {
  display: flex;
  flex-direction: row;
  margin-top: 5px;
  justify-content: space-between;
  align-items: center;
}

.subsidy_content {
  padding-top: 2.5px;
  padding-bottom: 2.5px;
  padding-left: 10px;
  padding-right: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #d03629;
  border-radius: 2.5px;
}
</style>
